package book.ch9;

import javax.swing.*;
import java.awt.*;

class MyComponetInWindow extends JFrame{
    public MyComponetInWindow(){
        init();
        setVisible(true);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
    private void init(){
        setLayout(new CardLayout());
        setBounds(100,100,450,260);
        setTitle("常用组件展示");
        JCheckBox checkBox1=new JCheckBox("身体健康");
        checkBox1.setBounds(0,0,4,4);
        JCheckBox checkBox2=new JCheckBox("万事如意");
        checkBox2.setBounds(0,0,4,4);
        ButtonGroup group=new ButtonGroup();
        JRadioButton radio1=new JRadioButton("男");
        JRadioButton radio2= new JRadioButton("女");
        group.add(radio1);
        group.add(radio2);

        add(checkBox1);
        add(checkBox2);
        add(radio1);
        add(radio2);

    }
}

public class E9_3 {
    public static void main(String[] args) {
        MyComponetInWindow cw=new MyComponetInWindow();
    }
}
